package com.dormitory.myt.service.impl;

import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.dormitory.myt.en.Detail;
import com.dormitory.myt.mapper.DetailMapper;
import com.dormitory.myt.service.DetailService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Slf4j
@Service
public class DetailServiceImpl extends ServiceImpl<DetailMapper, Detail> implements DetailService {
    @Autowired
    private DetailMapper detailMapper;
    @Override
    public void updateStudentid(Detail detail) {
        //根据宿舍号和床位号更新学生id，其他属性不变
        LambdaUpdateWrapper<Detail> updateWrapper = Wrappers.<Detail>lambdaUpdate()
                .eq(Detail::getSushehao,detail.getSushehao())
                .eq(Detail::getBed,detail.getBed());

        detailMapper.update(detail, updateWrapper);

    }
}
